package com.jspx.scriptmark.core.dispose;

import com.jspx.scriptmark.Phrase;
import com.jspx.scriptmark.core.EnvRunner;
import com.jspx.scriptmark.core.TagNode;
import com.jspx.utils.StringUtil;

import java.io.Writer;

/**
 * Created by yuan on 2015/2/1 0001.
 *
 */
public class CompressPhrase  implements Phrase
{
    public int getRun(EnvRunner env, TagNode tagNode, Writer out) throws Exception
    {
        String s = tagNode.getBody();
        StringBuilder sb = new StringBuilder();
        if (s != null)
            for (int i=0; i<s.length(); i++)
            {
                char c = s.charAt(i);
                if (c==' ') continue;
                sb.append(c);
            }
        out.write(StringUtil.trim(sb.toString()));
        return 0;
    }

}